package com.dc.common.exception;

import com.dc.common.constant.ResultStatus;

/**
 * @author zhuangcy
 * @date 2021/1/16
 * @description 业务异常类
 */
public class ServiceException extends RuntimeException {
    private int code = ResultStatus.ERROR_CODE.getCode();

    public ServiceException() {
        super("操作失败");
    }

    public ServiceException(String message) {
        super(message);
    }

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(int code, Throwable cause) {
        super(cause);
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}
